home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / dwgroup / dgroupw.exe / DGroup.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-11-18  |  13.8 KB  |  494 lines

  1. VERSION 5.00
  2. Object = "{5B494162-D2D9-11D1-A7C6-00C04FA30EBD}#1.0#0"; "DGroup.dll"
  3. Begin VB.Form Form1 
  4.    Caption         =   "DameWare Group Control Sample"
  5.    ClientHeight    =   6420
  6.    ClientLeft      =   5055
  7.    ClientTop       =   2940
  8.    ClientWidth     =   7635
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   6420
  11.    ScaleWidth      =   7635
  12.    StartUpPosition =   2  'CenterScreen
  13.    Begin VB.CommandButton Command12 
  14.       Caption         =   "Get Local Machine"
  15.       Height          =   375
  16.       Left            =   4080
  17.       TabIndex        =   7
  18.       Top             =   360
  19.       Width           =   1575
  20.    End
  21.    Begin VB.TextBox Text6 
  22.       Height          =   405
  23.       Left            =   240
  24.       TabIndex        =   4
  25.       Text            =   "Text6"
  26.       Top             =   3240
  27.       Width           =   2055
  28.    End
  29.    Begin VB.ListBox List1 
  30.       Height          =   1815
  31.       Left            =   240
  32.       Sorted          =   -1  'True
  33.       TabIndex        =   18
  34.       Top             =   4440
  35.       Width           =   7215
  36.    End
  37.    Begin VB.CommandButton Command11 
  38.       Caption         =   "Disconnect"
  39.       Height          =   375
  40.       Left            =   2400
  41.       TabIndex        =   17
  42.       Top             =   3960
  43.       Width           =   1575
  44.    End
  45.    Begin VB.TextBox Text5 
  46.       Height          =   375
  47.       Left            =   240
  48.       TabIndex        =   3
  49.       Text            =   "Text5"
  50.       Top             =   2520
  51.       Width           =   2055
  52.    End
  53.    Begin VB.CommandButton Command10 
  54.       Caption         =   "Get Current User"
  55.       Height          =   375
  56.       Left            =   5760
  57.       TabIndex        =   10
  58.       Top             =   1080
  59.       Width           =   1575
  60.    End
  61.    Begin VB.CommandButton Command9 
  62.       Caption         =   "Remove Member"
  63.       Height          =   375
  64.       Left            =   4080
  65.       TabIndex        =   15
  66.       Top             =   2520
  67.       Width           =   1575
  68.    End
  69.    Begin VB.CommandButton Command8 
  70.       Caption         =   "Add Member"
  71.       Height          =   375
  72.       Left            =   2400
  73.       TabIndex        =   14
  74.       Top             =   2520
  75.       Width           =   1575
  76.    End
  77.    Begin VB.CommandButton Command7 
  78.       Caption         =   "Connect"
  79.       Height          =   375
  80.       Left            =   2400
  81.       TabIndex        =   16
  82.       Top             =   3240
  83.       Width           =   1575
  84.    End
  85.    Begin VB.TextBox Text4 
  86.       Height          =   375
  87.       IMEMode         =   3  'DISABLE
  88.       Left            =   240
  89.       PasswordChar    =   "*"
  90.       TabIndex        =   5
  91.       Text            =   "Text4"
  92.       Top             =   3960
  93.       Width           =   2055
  94.    End
  95.    Begin VB.CommandButton Command6 
  96.       Caption         =   "Delete Group"
  97.       Height          =   375
  98.       Left            =   5760
  99.       TabIndex        =   13
  100.       Top             =   1800
  101.       Width           =   1575
  102.    End
  103.    Begin VB.CommandButton Command5 
  104.       Caption         =   "Add Global Group"
  105.       Height          =   375
  106.       Left            =   4080
  107.       TabIndex        =   12
  108.       Top             =   1800
  109.       Width           =   1575
  110.    End
  111.    Begin VB.CommandButton Command4 
  112.       Caption         =   "IsMember"
  113.       Height          =   375
  114.       Left            =   4080
  115.       TabIndex        =   9
  116.       Top             =   1080
  117.       Width           =   1575
  118.    End
  119.    Begin VB.CommandButton Command3 
  120.       Caption         =   "Get Group Users"
  121.       Height          =   375
  122.       Left            =   2400
  123.       TabIndex        =   11
  124.       Top             =   1800
  125.       Width           =   1575
  126.    End
  127.    Begin VB.TextBox Text3 
  128.       Height          =   375
  129.       Left            =   240
  130.       TabIndex        =   2
  131.       Text            =   "Text3"
  132.       Top             =   1800
  133.       Width           =   2055
  134.    End
  135.    Begin VB.CommandButton Command2 
  136.       Caption         =   "Get User Groups"
  137.       Height          =   375
  138.       Left            =   2400
  139.       TabIndex        =   8
  140.       Top             =   1080
  141.       Width           =   1575
  142.    End
  143.    Begin VB.CommandButton Command1 
  144.       Caption         =   "Get All Groups"
  145.       Default         =   -1  'True
  146.       Height          =   375
  147.       Left            =   2400
  148.       TabIndex        =   6
  149.       Top             =   360
  150.       Width           =   1575
  151.    End
  152.    Begin VB.TextBox Text2 
  153.       Height          =   375
  154.       Left            =   240
  155.       TabIndex        =   1
  156.       Text            =   "Text2"
  157.       Top             =   1080
  158.       Width           =   2055
  159.    End
  160.    Begin VB.TextBox Text1 
  161.       Height          =   375
  162.       Left            =   240
  163.       TabIndex        =   0
  164.       Text            =   "Text1"
  165.       Top             =   360
  166.       Width           =   2055
  167.    End
  168.    Begin VB.Shape Shape1 
  169.       BackStyle       =   1  'Opaque
  170.       FillColor       =   &H00FFFFFF&
  171.       FillStyle       =   0  'Solid
  172.       Height          =   375
  173.       Left            =   6000
  174.       Shape           =   3  'Circle
  175.       Top             =   360
  176.       Width           =   495
  177.    End
  178.    Begin VB.Label Label7 
  179.       Caption         =   "Connect UserID"
  180.       Height          =   255
  181.       Left            =   240
  182.       TabIndex        =   26
  183.       Top             =   3000
  184.       Width           =   2055
  185.    End
  186.    Begin VB.Label Label6 
  187.       Alignment       =   1  'Right Justify
  188.       Caption         =   "Label6"
  189.       Height          =   255
  190.       Left            =   5880
  191.       TabIndex        =   25
  192.       Top             =   3960
  193.       Width           =   1575
  194.    End
  195.    Begin DGROUPLibCtl.DGroupCtl DGroupCtl1 
  196.       Height          =   480
  197.       Left            =   7080
  198.       TabIndex        =   24
  199.       Top             =   120
  200.       Width           =   480
  201.       _cx             =   4592600
  202.       _cy             =   4592600
  203.       Valid           =   -1  'True
  204.       UserID          =   ""
  205.       Group           =   ""
  206.       Domain          =   ""
  207.       GroupComment    =   ""
  208.       ConnectUserID   =   ""
  209.       ConnectPassword =   ""
  210.    End
  211.    Begin VB.Label Label5 
  212.       Caption         =   "Group Comment"
  213.       Height          =   255
  214.       Left            =   240
  215.       TabIndex        =   23
  216.       Top             =   2280
  217.       Width           =   2055
  218.    End
  219.    Begin VB.Label Label4 
  220.       Caption         =   "Connect Password"
  221.       Height          =   255
  222.       Left            =   240
  223.       TabIndex        =   22
  224.       Top             =   3720
  225.       Width           =   2055
  226.    End
  227.    Begin VB.Label Label3 
  228.       Caption         =   "Group"
  229.       Height          =   255
  230.       Left            =   240
  231.       TabIndex        =   21
  232.       Top             =   1560
  233.       Width           =   2055
  234.    End
  235.    Begin VB.Label Label2 
  236.       Caption         =   "User ID"
  237.       Height          =   255
  238.       Left            =   240
  239.       TabIndex        =   20
  240.       Top             =   840
  241.       Width           =   1935
  242.    End
  243.    Begin VB.Label Label1 
  244.       Caption         =   "Domain or Machine Name"
  245.       Height          =   255
  246.       Left            =   240
  247.       TabIndex        =   19
  248.       Top             =   120
  249.       Width           =   2055
  250.    End
  251. Attribute VB_Name = "Form1"
  252. Attribute VB_GlobalNameSpace = False
  253. Attribute VB_Creatable = False
  254. Attribute VB_PredeclaredId = True
  255. Attribute VB_Exposed = False
  256. Private Sub Check1_Click()
  257. On Error GoTo ErrorHandler
  258. Exit Sub
  259. ErrorHandler:
  260.     OnErrorHandler
  261.     'Resume Next
  262. End Sub
  263. Private Sub Command1_Click()
  264. On Error GoTo ErrorHandler
  265. List1.Clear
  266. Shape1.FillColor = &H80FFFF    'yellow busy
  267. Shape1.Refresh
  268. DGroupCtl1.Domain = Text1.Text
  269. DGroupCtl1.SetFirstGroup
  270. i = 0
  271. While DGroupCtl1.GroupGetNext <> 0
  272.     List1.AddItem DGroupCtl1.Group + Chr(9) + DGroupCtl1.GroupComment
  273.     i = i + 1
  274.     Label6.Caption = "Count: " + Str(i)
  275.     Label6.Refresh
  276. Shape1.FillColor = &H80FF80 ' green - returned ok
  277. Shape1.Refresh
  278. Exit Sub
  279. ErrorHandler:
  280.     OnErrorHandler
  281. Shape1.FillColor = &HFF&       ' red - failed
  282. Shape1.Refresh
  283.     'Resume Next
  284. End Sub
  285. Private Sub Command10_Click()
  286. On Error GoTo ErrorHandler
  287. Shape1.FillColor = &H80FFFF    'yellow busy
  288. Shape1.Refresh
  289. Text2.Text = DGroupCtl1.GetCurrentUserID
  290. Shape1.FillColor = &H80FF80 ' green - returned ok
  291. Shape1.Refresh
  292. Exit Sub
  293. ErrorHandler:
  294.     OnErrorHandler
  295.     'Resume Next
  296. Shape1.FillColor = &HFF&       ' red - failed
  297. Shape1.Refresh
  298. End Sub
  299. Private Sub Command11_Click()
  300. On Error GoTo ErrorHandler
  301. Shape1.FillColor = &H80FFFF    'yellow busy
  302. Shape1.Refresh
  303. DGroupCtl1.Domain = Text1.Text
  304. DGroupCtl1.UserDisconnect
  305. Shape1.FillColor = &H80FF80 ' green - returned ok
  306. Shape1.Refresh
  307. Exit Sub
  308. ErrorHandler:
  309.     OnErrorHandler
  310.     'Resume Next
  311. Shape1.FillColor = &HFF&       ' red - failed
  312. Shape1.Refresh
  313. End Sub
  314. Private Sub Command12_Click()
  315. Shape1.FillColor = &H80FFFF    'yellow busy
  316. Shape1.Refresh
  317. Text1.Text = DGroupCtl1.GetLocalMachineName
  318. Shape1.FillColor = &H80FF80 ' green - returned ok
  319. Shape1.Refresh
  320. End Sub
  321. Private Sub Command2_Click()
  322. On Error GoTo ErrorHandler
  323. Dim Count As Long
  324. List1.Clear
  325. Shape1.FillColor = &H80FFFF    'yellow busy
  326. Shape1.Refresh
  327. DGroupCtl1.Domain = Text1.Text
  328. DGroupCtl1.UserID = Text2.Text
  329. DGroupCtl1.SetFirstUserGroup
  330. i = 0
  331. While DGroupCtl1.UserGroupGetNext <> 0
  332.     List1.AddItem DGroupCtl1.Group
  333.     i = i + 1
  334.     Label6.Caption = "Count: " + Str(i)
  335.     Label6.Refresh
  336. Shape1.FillColor = &H80FF80 ' green - returned ok
  337. Shape1.Refresh
  338. Exit Sub
  339. ErrorHandler:
  340.     OnErrorHandler
  341.     'Resume Next
  342. Shape1.FillColor = &HFF&       ' red - failed
  343. Shape1.Refresh
  344. End Sub
  345. Private Sub Command3_Click()
  346. On Error GoTo ErrorHandler
  347. List1.Clear
  348. Shape1.FillColor = &H80FFFF    'yellow busy
  349. Shape1.Refresh
  350. DGroupCtl1.Domain = Text1.Text
  351. DGroupCtl1.Group = Text3.Text
  352. DGroupCtl1.SetFirstUser
  353. i = 0
  354. While DGroupCtl1.UserGetNext <> 0
  355.     List1.AddItem DGroupCtl1.UserID
  356.     i = i + 1
  357.     Label6.Caption = "Count: " + Str(i)
  358.     Label6.Refresh
  359. Shape1.FillColor = &H80FF80 ' green - returned ok
  360. Shape1.Refresh
  361. Exit Sub
  362. ErrorHandler:
  363.     OnErrorHandler
  364.     'Resume Next
  365. Shape1.FillColor = &HFF&       ' red - failed
  366. Shape1.Refresh
  367. End Sub
  368. Private Sub Command4_Click()
  369. On Error GoTo ErrorHandler
  370. Shape1.FillColor = &H80FFFF    'yellow busy
  371. Shape1.Refresh
  372. Form1.Refresh
  373. DGroupCtl1.Domain = Text1.Text
  374. DGroupCtl1.UserID = Text2.Text
  375. DGroupCtl1.Group = Text3.Text
  376. If DGroupCtl1.IsMember = False Then
  377.     MsgBox "User " + DGroupCtl1.UserID + " Is NOT Member of group " + Text3.Text
  378.     MsgBox "User " + DGroupCtl1.UserID + " Is Member of group " + Text3.Text
  379. End If
  380. Shape1.FillColor = &H80FF80 ' green - returned ok
  381. Shape1.Refresh
  382. Exit Sub
  383. ErrorHandler:
  384.     OnErrorHandler
  385.     'Resume Next
  386. Shape1.FillColor = &HFF&       ' red - failed
  387. Shape1.Refresh
  388. End Sub
  389. Private Sub Command5_Click()
  390. On Error GoTo ErrorHandler
  391. Shape1.FillColor = &H80FFFF    'yellow busy
  392. Shape1.Refresh
  393. DGroupCtl1.Domain = Text1.Text
  394. DGroupCtl1.Group = Text3.Text
  395. DGroupCtl1.GroupComment = Text5.Text
  396. DGroupCtl1.GroupAdd
  397. Shape1.FillColor = &H80FF80 ' green - returned ok
  398. Shape1.Refresh
  399. Exit Sub
  400. ErrorHandler:
  401.     OnErrorHandler
  402.     'Resume Next
  403. Shape1.FillColor = &HFF&       ' red - failed
  404. Shape1.Refresh
  405. End Sub
  406. Private Sub Command6_Click()
  407. On Error GoTo ErrorHandler
  408. Shape1.FillColor = &H80FFFF    'yellow busy
  409. Shape1.Refresh
  410. DGroupCtl1.Domain = Text1.Text
  411. DGroupCtl1.Group = Text3.Text
  412. DGroupCtl1.GroupDelete
  413. Shape1.FillColor = &H80FF80 ' green - returned ok
  414. Shape1.Refresh
  415. Exit Sub
  416. ErrorHandler:
  417.     OnErrorHandler
  418.     'Resume Next
  419. Shape1.FillColor = &HFF&       ' red - failed
  420. Shape1.Refresh
  421. End Sub
  422. Private Sub Command7_Click()
  423. On Error GoTo ErrorHandler
  424. Shape1.FillColor = &H80FFFF    'yellow busy
  425. Shape1.Refresh
  426. DGroupCtl1.Domain = Text1.Text
  427. DGroupCtl1.ConnectUserID = Text6.Text
  428. DGroupCtl1.ConnectPassword = Text4.Text
  429. DGroupCtl1.UserConnect
  430. Shape1.FillColor = &H80FF80 ' green - returned ok
  431. Shape1.Refresh
  432. Exit Sub
  433. ErrorHandler:
  434.     OnErrorHandler
  435.     'Resume Next
  436. Shape1.FillColor = &HFF&       ' red - failed
  437. Shape1.Refresh
  438. End Sub
  439. Private Sub Command8_Click()
  440. On Error GoTo ErrorHandler
  441. Shape1.FillColor = &H80FFFF    'yellow busy
  442. Shape1.Refresh
  443. DGroupCtl1.Domain = Text1.Text
  444. DGroupCtl1.UserID = Text2.Text
  445. DGroupCtl1.Group = Text3.Text
  446. DGroupCtl1.GroupAddMember
  447. Shape1.FillColor = &H80FF80 ' green - returned ok
  448. Shape1.Refresh
  449. Exit Sub
  450. ErrorHandler:
  451.     OnErrorHandler
  452.     'Resume Next
  453. Shape1.FillColor = &HFF&       ' red - failed
  454. Shape1.Refresh
  455. End Sub
  456. Private Sub Command9_Click()
  457. On Error GoTo ErrorHandler
  458. Shape1.FillColor = &H80FFFF    'yellow busy
  459. Shape1.Refresh
  460. DGroupCtl1.Domain = Text1.Text
  461. DGroupCtl1.UserID = Text2.Text
  462. DGroupCtl1.Group = Text3.Text
  463. DGroupCtl1.GroupRemoveMember
  464. Shape1.FillColor = &H80FF80 ' green - returned ok
  465. Shape1.Refresh
  466. Exit Sub
  467. ErrorHandler:
  468.     OnErrorHandler
  469.     'Resume Next
  470. Shape1.FillColor = &HFF&       ' red - failed
  471. Shape1.Refresh
  472. End Sub
  473. Private Sub Form_Load()
  474. On Error GoTo ErrorHandler
  475. Text1.Text = DGroupCtl1.GetLocalMachineName
  476. Text2.Text = DGroupCtl1.GetCurrentUserID
  477. Text3.Text = ""
  478. Text4.Text = ""
  479. Text5.Text = ""
  480. Text6.Text = DGroupCtl1.GetCurrentUserID
  481. Label6.Caption = "Count:    "
  482. Shape1.FillColor = &H80FF80 ' green - returned ok
  483. Shape1.Refresh
  484. Exit Sub
  485. ErrorHandler:
  486.     OnErrorHandler
  487.     'Resume Next
  488. End Sub
  489. Sub OnErrorHandler()
  490. If Err.Number <> 0 Then
  491.     MsgBox Err.Description, , "Error"
  492. End If
  493. End Sub
  494.